package com.zyy.seckill.rabbitmq;

import com.zyy.seckill.config.RabbitmqConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 *      发送秒杀信息
 * @Author: zyy
 * @DateTime: 2021/10/5 19:34
 */
@Slf4j
@Service
public class MQSender {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendScekillMessage(String message){
       log.info("发送消息: "+message);
       rabbitTemplate.convertAndSend(RabbitmqConfig.EXCHANGE_NAME,"seckill.message",message);
    }
}
